FragmentStatePagerAdapter

constructor(@NonNull fm: FragmentManager, behavior: Int)(source)

Constructor for FragmentStatePagerAdapter. If BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT is passed in, then only the current Fragment is in the RESUMED state, while all other fragments are capped at STARTED. If BEHAVIOR_SET_USER_VISIBLE_HINT is passed, all fragments are in the RESUMED state and there will be callbacks to setUserVisibleHint.

Parameters

fm

fragment manager that will interact with this adapter

behavior

determines if only current fragments are in a resumed state


constructor(@NonNull fm: FragmentManager)(source)

Constructor for FragmentStatePagerAdapter that sets the fragment manager for the adapter. This is the equivalent of calling FragmentStatePagerAdapter and passing in BEHAVIOR_SET_USER_VISIBLE_HINT.

Fragments will have setUserVisibleHint called whenever the current Fragment changes.

Parameters

fm

fragment manager that will interact with this adapter